
<script setup>
//使用reactive包裹--对象,变成响应式
import { reactive } from 'vue';
const state=reactive({
  count:0
})
console.log(state);
const addstate=()=>{
  state.count++ 
  console.log('state',state.count);
}

//不使用reactive包裹对象,变成非响应式
const state2={
  count:0
}
console.log(state2);
const addstate2=()=>{
  state2.count++
  console.log(state2.count);
}
</script>

<template>
  <div>

  </div>
  <button @click="addstate">state:{{ state.count }}</button>
  <button @click="addstate2">state2:{{ state2.count }}</button>
</template>


<style lang="scss" scoped>

</style>